To run Windows Script Host
Click the task that you want to perform.
To start a script so that it runs in a Windows environment
- Open Command Prompt.
- Type:
wscript [ScriptName] [//B] [//D] [//E:Engine] [//H:CScript | //H:WScript] [//I] [//Job:Identifier] [//Logo | //NoLogo] [//S] [//T:Number] [//X] [//?] [ScriptArguments]
Parameters
- ScriptName
- Specifies the path and file name of the script file.
- //B
- Specifies batch mode, which does not display alerts, scripting errors, or input prompts.
- //D
- Starts the debugger.
- //E:Engine
- Specifies the engine that is used to run the script.
- //H:cscript
- Registers Cscript.exe as the default script host for running scripts.
- //H:wscript
- Registers Wscript.exe as the default script host for running scripts. This is the default.
- //I
- Specifies interactive mode, which displays alerts, scripting errors, and input prompts. This is the default and the opposite of //B.
- //Job:Identifier
- Runs the job identified by Identifier in a .wsf script file.
- //Logo
- Specifies that the Windows Script Host banner is displayed in the console before the script runs. This is the default and the opposite of //Nologo.
- //Nologo
- Specifies that the Windows Script Host banner is not displayed before the script runs.
- //S
- Saves the current command-prompt options for the current user.
- //T:Number
- Specifies the maximum time the script can run (in seconds). You can specify up to 32,767 seconds. The default is no time limit.
- //X
- Starts the script in the debugger.
- //?
- Displays available command parameters and provides help for using them.
- ScriptArguments
- Specifies the arguments passed to the script. Each script argument must be preceded by a slash (/).
Remarks
- XOX
- XOX
- Each parameter is optional; however, you cannot specify script arguments without specifying a script. If you do not specify a script or any script arguments, Wscript.exe displays the Windows Script Host Settings dialog box, which you can use to set global scripting properties for all scripts that Wscript.exe runs on the local computer.
- The //T parameter prevents excessive running of scripts by setting a timer. When the time exceeds the specified value, WScript interrupts the script engine and ends the process.
- Windows script files usually have one of the following file name extensions: .wsf, .vbs, .js.
- If you double-click a script file with an extension that has no association, the Open With dialog box appears. Select Wscript or Cscript, and then select Always use this program to open this file type. This registers Wscript.exe or Cscript as the default script host for files of this file type.
- You can set properties for individual scripts. See Related Topics for more information.
- Windows Script Host can use .wsf script files. Each .wsf file can use multiple scripting engines and perform multiple jobs.
To start a script so that it runs in a command-line environment
- Open Command Prompt.
- Type:
cscript [ScriptName] [//B] [//D] [//E:Engine] [//H:CScript | //H:WScript] [//I] [//Job:Identifier] [//Logo | //NoLogo] [//S] [//T:Number] [//X] [//U] [//?] [ScriptArguments]
Parameters
- ScriptName
- Specifies the path and file name of the script file.
- //B
- Specifies batch mode, which does not display alerts, scripting errors, or input prompts.
- //D
- Starts the debugger.
- //E:Engine
- Specifies the engine that is used to run the script.
- //H:cscript
- Registers Cscript.exe as the default script host for running scripts.
- //H:wscript
- Registers Wscript.exe as the default script host for running scripts. This is the default.
- //I
- Specifies interactive mode, which displays alerts, scripting errors, and input prompts. This is the default and the opposite of //B.
- //Job:Identifier
- Runs the job identified by Identifier in a .wsf script file.
- //Logo
- Specifies that the Windows Script Host banner is displayed in the console before the script runs. This is the default and the opposite of //Nologo.
- //Nologo
- Specifies that the Windows Script Host banner is not displayed before the script runs.
- //S
- Saves the current command-prompt options for the current user.
- //T:Number
- Specifies the maximum time the script can run (in seconds). You can specify up to 32,767 seconds. The default is no time limit.
- //U
- Specifies Unicode for input and output that is redirected from the console.
- //X
- Starts the script in the debugger.
- //?
- Displays available command parameters and provides help for using them. This is the same as typing Cscript.exe with no parameters and no script.
- ScriptArguments
- Specifies the arguments passed to the script. Each script argument must be preceded by a slash (/).
Remarks
- XOX
- XOX
- Each parameter is optional; however, you cannot specify script arguments without specifying a script. If you do not specify a script or any script arguments, Cscript.exe displays the Cscript.exe syntax and the valid host options.
- The //T parameter prevents excessive running of scripts by setting a timer. When the run time exceeds the specified value, CScript interrupts the script engine and ends the process.
- Windows script files usually have one of the following file name extensions: .wsf, .vbs, .js.
- You can set properties for individual scripts. See Related Topics for more information.
- Windows Script Host can use .wsf script files. Each .wsf file can use multiple scripting engines and perform multiple jobs.
- If you double-click a script file with an extension that has no association, the Open With dialog box appears. Select Wscript or Cscript, and then select Always use this program to open this file type. This registers Wscript.exe or Cscript as the default script host for files of this file type.
- You can set properties for individual scripts. See Related Topics for more information.
- Windows Script Host can use .wsf script files. Each .wsf file can use multiple scripting engines and perform multiple jobs.
XOX
Related Topics